﻿namespace PLCS.Domain.Tasks;

public class InstructionRunningLog : BaseEntity
{
    public Guid InstructionId { get; set; }
    public Instruction Instruction { get; set; }

    /// <summary>
    /// 异常信息
    /// </summary>
    public string ExceptionMsg { get; set; }

    /// <summary>
    /// 是否处理
    /// </summary>
    public bool IsDispose { get; private set; }

    private InstructionRunningLog()
    {
    }

    public InstructionRunningLog(Guid instructionId, string exceptionMsg)
    {
        InstructionId = instructionId;
        ExceptionMsg = exceptionMsg;
        IsDispose = false;
        CreationTime = DateTime.Now;
    }

    public InstructionRunningLog Dispose()
    {
        IsDispose = true;
        return this;
    }
}